package com.dragon.modules.yuegou.client.wechat_mini.common;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;

public class TimestampUtils {
	
	private TimestampUtils() {
		
	}

	public static Long toTimestamp(LocalDateTime dateTime) {
		return dateTime.atZone(ZoneId.systemDefault()).toEpochSecond();
	}

	public static LocalDateTime fromTimestamp(Long timestamp) {
		return LocalDateTime.ofInstant(Instant.ofEpochSecond(timestamp), ZoneId.systemDefault());
	}

}
